package com.sakura.mybatis.builder;

import com.sakura.mybatis.config.Configuration;
import com.sakura.mybatis.factory.DefaultSqlSessionFactory;
import com.sakura.mybatis.factory.SqlSessionFactory;

import javax.xml.parsers.ParserConfigurationException;
import java.io.InputStream;

/**
 * @author wangxinyuchuan
 * @version SqlSessionFactoryBuilder.java v1.0 2025/4/15 15:36 wangxinyuchuan Exp $
 */
public class SqlSessionFactoryBuilder {

    public static SqlSessionFactory build(InputStream inputStream) throws ParserConfigurationException {
        XmlConfigBuilder parser = new XmlConfigBuilder();
        return build(parser.parse(inputStream));

    }

    private static SqlSessionFactory build(Configuration configuration) {
        return new DefaultSqlSessionFactory(configuration);
    }

}
